<?php Yii::app()->clientScript->registerScriptFile(Yii::app()->params['static'].'assets/js/bootbox.min.js',2); ?>
<div class="page-header">
							<h1>
							我已参加过的活动
							</h1><p>记录数目小于活动数目，可能是由于有的活动已在后台关闭</p>
</div>
<div class="row">
		<div class="col-xs-12">
					<div class="row">
					<div class="widget-box">
											<div class="widget-header widget-header-flat">
												<h4 class="smaller">
												我参加过的活动
												</h4>
											</div>

											<div class="widget-body">
												<div class="widget-main">
									<div class="table-responsive">
											<table id="sample-table-1" class="table table-striped table-bordered table-hover">
												<thead>
													<tr>
														
														<th>活动名称</th>
														
														<th class="hidden-480">活动内容</th>
														
														<th class="hidden-480">活动要求</th>
														<th class="hidden-480">我填写的</th>
														<th class="hidden-480">状态</th>
														

														<th>
															<i class="icon-time bigger-110 hidden-480"></i>
															参加时间
														</th>
														
														<th>删除</th>
													</tr>
												</thead>

												<tbody>
												<?php
												  foreach($stuAcs  as $a){
													     $deleteButton = '<button class="btn btn-xs btn-danger" delete-id = "'.$a->stuActivityId.'" ><i class="icon-trash bigger-120"></i></button>';
														 //1 ---- 未审核 2 ---- 未通过 3 --- 已通过
														 if($a->condition == '1'){
															 $con = '<span class="label label-sm label-warning"><i class="icon-spinner"></i>&nbsp未审核</span>';
														 }else if($a->condition == '2'){
															 $con = '<span class="label label-sm label-danger"><i class="icon-remove"></i>&nbsp未通过</span>';
														 }else{
															 $con = '<span class="label label-sm label-success"><i class="icon-ok"></i>&nbsp已通过</span>';
														     $deleteButton   = '';
														 }
													 echo '
													<tr id="'.$a->stuActivityId.'">
														<td>
															<a href="#">'.$a->activity->name.'</a>
														</td>
														
														<td class="hidden-480">
														<span display-content-id="'.$a->activity->activityId.'" style="display:none;">'.$a->activity->content.'</span>
															<button class="btn btn-sm btn-info" content-id="'.$a->activity->activityId.'">
																详情
															</button>
														</td>
														
														<td>
														 <span display-requirement-id="'.$a->activity->activityId.'" style="display:none;">'.$a->activity->requirement.'</span>
														  <button class="btn btn-sm btn-warning" requirement-id="'.$a->activity->activityId.'" >
														    要求
														  </button>
														</td>
														
														<td>
														 <span display-detail-id="'.$a->stuActivityId.'" style="display:none;">'.$a->detail.'</span>
														  <button class="btn btn-sm btn-purple" detail-id="'.$a->stuActivityId.'" >
														    学生填写
														  </button>
														</td>
														<td>'.$con.'</td>
														<td>'.$a->addtime.'</td>
														

														
														<td>
															<div class="visible-md visible-lg hidden-sm hidden-xs btn-group">
												               '.$deleteButton.'
															</div>

														</td>
													</tr>';
												  }
                                                   ?>
												</tbody>
											</table>
											
											</div>
										</div>
									</div>	 
								</div><!-- /.table-responsive -->

						</div>
		</div>
</div>
<script type="text/javascript">
   jQuery(function($){
	   
	   $('[requirement-id]').on("click",function(){
			var id = $(this).attr('requirement-id');
			bootbox.alert($("[display-requirement-id = "+id+"]").html(),function(){
				
				
			});

		  
		   
	   });
	   
	   $('[content-id]').on("click",function(){
			var id = $(this).attr('content-id');
			bootbox.alert($("[display-content-id = "+id+"]").html(),function(){
				
				
			});

		  
		   
	   });
	   $('[detail-id]').on("click",function(){
			var id = $(this).attr('detail-id');
			bootbox.alert($("[display-detail-id = "+id+"]").html(),function(){
				
				
			});

		  
		   
	   });
	   $('[delete-id]').on("click",function(){
              var id = $(this).attr('delete-id');		   
		      $.post("<?php echo Yii::app()->createUrl('stuactivity/delete');?>",{'id':id},function(data){
				   data = $.parseJSON(data);
				   bootbox.alert(data['msg'],function(){
					  if(data['code'] == '200'){
						  $('#'+id).fadeToggle('800','linear',function(){
						                 $(this).remove();	  
							  
						  });
						  
					  } 
					   
				   });
				  
			  });
		  
	   });
	   
   })
</script>	
